package com.yuanfeng.payment.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yuanfeng.commoms.dto.order.WapGoodsSaleSumDTO;
import com.yuanfeng.commoms.vo.payment.CardMemberservicesVO;
import com.yuanfeng.commoms.vo.user.UserInfoVO;
import com.yuanfeng.payment.dto.AssetTmpInfoDTO;
import com.yuanfeng.payment.entity.PayUserResourceEntity;
import com.yuanfeng.payment.vo.AccountBalanceDisplayVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * @Entity com.yuanfeng.payment.entity.PayUserResource
 */
@Mapper
public interface PayUserResourceMapper extends BaseMapper<PayUserResourceEntity> {

    /**
     * 查询账户余额
     *
     * @param userId
     * @return
     */
    AccountBalanceDisplayVO queryAccountBalance(@Param("userId") String userId);

    /**
     * 更新用户资源
     *
     * @param userId
     * @param money
     * @return
     */
    boolean updateUserResource(@Param("userId") String userId, @Param("money") String money);

    /**
     * 获取用户信息
     *
     * @param userMobile
     * @return
     */
    UserInfoVO getUserInfoByMobile(@Param("userMobile") String userMobile);

    /**
     * 更新金额
     *
     * @param toUserId
     * @param money
     * @return
     */
    boolean updateToMoney(@Param("toUserId") String toUserId, @Param("money") String money);

    /**
     * 查询账户余额
     * @param userId
     * @return
     */
    BigDecimal queryBalanceMoney(@Param("userId")String userId);

    /**
     * 扣除购物金额
     * @param userId
     * @param amountActuallyPaids
     * @return
     */
    boolean updateMoney(@Param("userId") String userId, @Param("amountActuallyPaids") BigDecimal amountActuallyPaids);

    /**
     * 查询账户购物卡余额
     * @param userId
     * @return
     */
    BigDecimal queryGiftCardMoney(@Param("userId")String userId);

    /**
     * 扣除购物卡金额
     * @param userId
     * @param amountActuallyPaids
     * @return
     */
    boolean updateGiftCardMoney(@Param("userId") String userId, @Param("totalPrice") BigDecimal amountActuallyPaids);

    /**
     * 判断纯数字订单
     *
     * @param orderId
     * @param paymentNumber
     * @return
     */
    List<AssetTmpInfoDTO> queryAssetInfo(@Param("orderId") String orderId, @Param("paymentNumber") String paymentNumber);

    /**
     * 查询买方用户ID
     *
     * @param orderId
     * @return
     */
    String queryBuyerUserIdByOrderBase(@Param("orderId") String orderId);


    /**
     * 查询卡成员服务端口
     *
     * @param page
     * @param map
     * @return
     */
    IPage<CardMemberservicesVO> query(IPage<CardMemberservicesVO> page, @Param("param") Map<String, Object> map);


    /**
     * 更新扣除用户金额
     *
     * @param payUserId
     * @param money
     * @return
     */
    boolean updateDeductUserMoney(String payUserId, BigDecimal money);



    /**
     * 查询用户金额
     *
     * @param userId
     * @return
     */
    BigDecimal queryUserMoney(String userId);

    /**
     * 更新最小用户货币
     *
     * @param userId
     * @param settlementMoney
     * @return
     */
    boolean updateMinusUserMoney(@Param("userId") String userId, @Param("settlementMoney") String settlementMoney);


    /**
     * 更新用户金额
     *
     * @param userId
     * @param money
     * @return
     */
    boolean updateUserMoney(@Param("userId") String userId, @Param("money") BigDecimal money);

    /**
     * 查找订单商品id
     * @param orderId
     * @return
     */
    List<WapGoodsSaleSumDTO> queryGoodsByOrderId(@Param("orderId") String orderId);
}




